<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<title>可用可信家庭市场</title>
<!--                       CSS                       -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="/static/css/reset.css" type="text/css" media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="/static/css/invalid.css" type="text/css" media="screen" />
<!--                       Javascripts                       -->
<!-- jQuery -->
<script type="text/javascript" src="/static/scripts/jquery-1.3.2.min.js"></script>
<!-- jQuery Configuration -->
<script type="text/javascript" src="/static/scripts/simpla.jquery.configuration.js"></script>
<!-- Facebox jQuery Plugin -->
<script type="text/javascript" src="/static/scripts/facebox.js"></script>
<!-- jQuery WYSIWYG Plugin -->
<script type="text/javascript" src="/static/scripts/jquery.wysiwyg.js"></script>
<!-- jQuery Datepicker Plugin -->
<script type="text/javascript" src="/static/scripts/jquery.datePicker.js"></script>
<script type="text/javascript" src="/static/scripts/jquery.date.js"></script>
<!-- jQuery -->
<script src="bower_components/jquery/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="/static/css/motai.css">
<script type="text/javascript" src="/static/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/js/jquery.leanModal.min.js"></script>
<style>
		body{
			font-family:黑体;
		}
		.tmain {
			margin-left:0px;
			width:1123px;
			text-align:center;
			background-color:#d9edf7;
			padding-left:90px;
			
		}

		#cgmain {width:1123px;
			text-align:center;

			}
		.day1{
			background-color:#d9edf7;
			text-align:center;
			padding-left:100px;
			margin-left:0px;
		}	
		.pihao_ul{
			list-style:none;
			border:hidden;
		}
		.pihao_ul li {
			float:left;
			width:250px;text-align:center;line-height:33px;
			font-size:15px;
			list-style-type:none;
		}

		.menu_ul ul {
			list-style-type:none;
			text-align:center;
			
		}
		.menu_ul li {
			border-left:1px solid #000;float:left;
			width:110px;height:30px;text-align:center;line-height:33px;
			font-size:15px;
			list-style-type:none;
			
		}
		.menu_ul li.b1 {border-bottom:1px solid #000;}
		.menu_ul li.r1 {border-right:1px solid #000;}
		

		.menu_ul li.cm1 {width:220px;}
		.menu_ul li.sl {width:70px;}
		.menu_ul li.sl1 {width:300px;}
		.menu_ul li.bj1 {width:70px;}
		.th1{
		border-top:1px solid #000;
		border-bottom:1px solid #000;
		}
		.menu_ul li.bz1 {width:360px;font-size:12px;}
.nocg {
                color: #333;
                padding: 8px 10px;
                display: block;
                margin: 1px;
                border-bottom: 0;
         }
	</style>
</head>
<body>
<div id="body-wrapper">
	<!-- Wrapper for the radial gradient background -->
	<div id="sidebar">
		<div id="sidebar-wrapper">

			<div id="profile-links">
				<!-- Logo (221px wide) -->
				<a href="#"><img id="logo" src="/static/images/logo.png" alt="Simpla Admin logo" /></a>

				{$_COOKIE['user_name']},你好 <br/>
				| <a href="/index.php/index/index/uexit" title="Sign Out">退出</a> </div>

			 <ul id="main-nav">
                <!-- Accordion Menu -->
                <!--<li> <a href="#/" class="nav-top-item no-submenu">-->
                    <!--&lt;!&ndash; Add the class "no-submenu" to menu items with no sub menu &ndash;&gt;-->
                    <!--Dashboard </a> </li>-->
                {if condition="!empty($powers['order_action'])"}
                <li> <a href="#" class="nav-top-item"> 订单操作</a>
                    <ul>
                    	
                        <li><a href="/index.php/index/index/neworder_list">新订单</a></li>
                        <!-- Add class "current" to sub menu items also -->
                        <li><a href="/index.php/index/index/addorder">创建新订单</a></li>
                        <li><a href="/index.php/index/index/allorder_list">所有订单</a></li>
                    </ul>
                </li>
           	{/if}
           	 {if condition="!empty($powers['cg_action'])"}
                <li> <a href="#" class="nav-top-item  current"> 采购单 </a>
                    <ul>
                        <li><a  class="current" href="/index.php/index/index/newcg_list">待处理 采购单</a></li>
                        <li><a href="/index.php/index/index/cg_history">采购单历史</a></li>
                    </ul>
                </li>
             {/if}
              {if condition="!empty($powers['table_action'])"}
                <li> <a href="#" class="nav-top-item"> 报表 </a>
                    <ul>
                        <li><a href="/index.php/index/biao/daybiao">日报表</a></li>
                        <li><a href="/index.php/index/biao/yuebiao">月报表</a></li>
                        <li><a href="/index.php/index/biao/nianbiao">年报表</a></li>
                    </ul>
                </li>
               {/if}
                {if condition="!empty($powers['goods_action'])"}
                <li> <a href="#" class="nav-top-item">菜品管理 </a>
                    <ul>
                        <li><a href="/index.php/index/goods/goods">所有菜品</a></li>
                        <li><a href="/index.php/index/goods/categorys">所有分类</a></li>
                    </ul>
                </li>
                {/if}
                 {if condition="!empty($powers['promotion_action'])"}
                 <li> <a href="#" class="nav-top-item"> 推广活动 </a>
                    <ul>
                        <li><a href="/index.php/index/promotion/snlist">SN优惠码</a></li>
                    </ul>
                </li>
                {/if}
                
                <li> <a href="#" class="nav-top-item"> 个人信息 </a>
                    <ul>
                        <li><a href="/index.php/index/index/user_info">查看信息</a></li>
                        <li><a href="/index.php/index/index/update_pass">修改密码</a></li>
                    </ul>
                </li>
       
                {if condition="!empty($powers['super'])"}
                 <li><a href="#" class="nav-top-item"> 用户管理 </a>
                 	<ul>
                        <li><a href="/index.php/index/admin/user_admin">用户权限</a></li>
                    </ul>
                 </li>
                {/if}

            </ul>
            <!-- End #main-nav -->
		</div>
	</div>
	<!-- End #sidebar -->
	<div id="main-content">
		<!-- Main Content Section with everything -->


		<!--tiles start-->
		<div class="row">
            <div class="big">
                <a href="/index.php/index/index/neworder_list">
                <div class="dashboard-tile detail tile-red">
                    <br/>
                    <p>
                    <font style="font-size:40px;" id="message_tips">0</font><br/><br/><br/>
                        <font style="font-size:25px;">新订单</font>
                    </p>
                </div>
                    </a>
            </div>
            <div class="big"  style="margin-left:20px;">
                <a href="/index.php/index/index/newcg_list">
                <div class="dashboard-tile detail tile-turquoise">
                    <br/>
                        <p>
                            <font style="font-size:40px;">{$cgcount}</font><br/><br/><br/>
                            <font style="font-size:25px;">采购单</font>
                        </p>
                </div>
                    </a>
            </div>
            <div class="big" style="margin-left:20px;">
                <a href="/index.php/index/index/ps_list">
                <div class="dashboard-tile detail tile-purple" >
                    <br/>
                    <p>
                        <font style="font-size:40px;">{$pscount}</font><br/><br/><br/>
                        <font style="font-size:25px;">配送单</font>
                    </p>
                </div>
                </a>
            </div>
        </div>
		<!--tiles end-->
		<!-- End .shortcut-buttons-set -->
		<div class="clear"></div>
		<!-- End .clear -->
		<h4 style="font-family: 微软雅黑">待处理 采购单</h4>
		<div class="content-box" style="height:72px;">

			<!-- Start Content Box -->
			<div class="content-box-header" style="height:50px;">

				<ul class="content-box-tabs" style="list-style:none;">
					{volist name="dmenu" id="m"}
					<li>
						
							{if condition="$default==$key"}
							<a href="#tab{$key}" style="text-align:center;" class="default-tab">&nbsp;{$m.time}&nbsp;
							{else/}
							<a href="#tab{$key}" style="text-align:center;">&nbsp;{$m.time}&nbsp;
							{/if}
							<br/>
							<font style="color:red; text-align:center;">
								{if condition="$m['num']>0"}
								{$m.num}
								{/if}
							</font>
							</a>
						
					</li>
					{/volist}
					<!-- href must be unique and match the id of target div -->
					
					<li>
						{if condition="$d2count>0"}
							<a href="#tab7"style="text-align:center;">&nbsp;明天&nbsp;<br/>
							<font style="color:red; text-align:center;">{$d2count}</font>
							</a>
						{else /}
							<font class="nocg" style="text-align:center;">&nbsp;明天&nbsp;</font>
						{/if}
					</li>
					<li>
						{if condition="$d3count>0"}
							<a href="#tab8"style="text-align:center;">&nbsp;后天&nbsp;<br/>
							<font style="color:red; text-align:center;">{$d3count}</font>
							</a>
						{else /}
							<font class="nocg" style="text-align:center;">&nbsp;后天&nbsp;</font>
						{/if}
					</li>
					
				</ul>
				<div class="clear"></div>
			</div>
			<!-- End .content-box-header -->
			<?php $sss=1;?>
			<div class="content-box-content" >
	{if condition="!empty($day1)"}
	{volist name="day1" id="dv" key="dk"}
					{if condition="$key == $default"}
					<div class="tab-content default-tab tmain" id="tab{$key}" style="padding-left:0px;">
					{else/}
					<div class="tab-content tmain" id="tab{$key}" style="padding-left:0px;">	
					{/if}

								{volist name="dv" id="v" key="k"}
								<?php $sss+=1;?>
							<div class="day1" style="margin-bottom:50px;float:left;">
								
								<button type="button" onclick="printPage({$sss},'{$v.cg_number}')" style="float:right;" class="button medium back"  >A4纸打印</button>
								<a href="/index.php/index/index/printcg/cg_number/{$v.cg_number}" style="float:right;" class="button medium back">超市小票纸打印</a>
								
								<!--startprint{$sss}-->
								<div id="cgmain">
									<div class="cgdiv">
										<div style="font-size:25px;text-align:center;margin-bottom:-20px;">采购单</div>
										<ul class="pihao_ul">
											<li>可用可信家庭市场</li>
											<li>批号：{$v.cg_number}</li>
											<li>配送日期： {$v.ps_date|date='Y-m-d',###}</li>
											<li>配送时间:
											{if condition="($v.ps_time == 9)"}9:00-10:00
											{elseif condition="$v.ps_time == 10"}10:00-11:00
											{elseif condition="$v.ps_time == 11"}11:00-12:00

											{elseif condition="$v.ps_time == 15"}15:00-16:00
											{elseif condition="$v.ps_time == 16"}16:00-17:00
											{elseif condition="$v.ps_time == 17"}17:00-18:00
											{else /}
											{/if}
											</li>
										</ul>
										
									</div>
									<div class="menu_ul">
										<ul>
											<li class="cm1 th1">菜单名</li>
											<li class="sl th1">份数</li>
											<li class="sl1 th1">数量</li>
											<li class="bj1 th1">标价</li>
											<li class="r1 bz1 th1">备注</li>

											
											<?php $cout=0;$sum=0;?>

											{volist name="v['cg']" id="vo" key="kk" }
											
<?php $sum+=($vo['goods_price']*$vo['num']);?>
											<?php ++$cout;?>
	
											<li class="b1 cm1">{$vo.goods_name}</li>
											<li class="b1 sl">{$vo.num}</li>
											<li class="b1 sl1">{$vo.guige}</li>
											<li class="b1 bj1">{$vo.goods_price}</li>
											<li class="b1 r1 bz1">{$vo.desc}</li>

											{/volist}


										</ul>
									
									</div>
									<div class="pihao_ul">
										<ul>
											<li>总金额：{$sum} &nbsp; &nbsp;(元)</li>
											<li>确认采购:(章)</li>
											<li>采购员签名：</li>
											<li>完成时间:</li>
										</ul>	
									</div>
								</div>
								<!--endprint{$sss}-->
								</div>
								{/volist}
								
								
				</div>
				{/volist}
	{/if}
	
				{if condition="!empty($day2)"}
<div class="tab-content tmain" id="tab7" style="padding-left:0px;">
	<?php $k=20;?>
							{volist name="day2" id="dv" key="dk"}
							<div class="day1" style="margin-bottom:50px;float:left;">
								{volist name="dv" id="v" key="kk"}
								<?php $sss+=1;?>
							<button type="button" onclick="printPage({$sss},'{$v.cg_number}')" style="float:right;" class="button medium back">A4纸打印</button>
								<a href="/index.php/index/index/printcg/cg_number/{$v.cg_number}" style="float:right;" class="button medium back">超市小票纸打印</a>
						
									
								<!--startprint{$sss}-->
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<div id="cgmain">
									<div class="cgdiv">
										<div style="font-size:25px;text-align:center;margin-bottom:-20px;margin-top:-10px;">采购单</div>
										<ul class="pihao_ul">
											<li>可用可信家庭市场</li>
											<li>批号：{$v.cg_number}</li>
											<li>配送日期： {$v.ps_date|date='Y-m-d',###}</li>
											<li>配送时间:
											{if condition="($v.ps_time == 9)"}9:00-10:00
											{elseif condition="$v.ps_time == 10"}10:00-11:00
											{elseif condition="$v.ps_time == 11"}11:00-12:00

											{elseif condition="$v.ps_time == 15"}15:00-16:00
											{elseif condition="$v.ps_time == 16"}16:00-17:00
											{elseif condition="$v.ps_time == 17"}17:00-18:00
											{else /}
											{/if}
											</li>
										</ul>
										
									</div>
									<div class="menu_ul">
										<ul>
											<li class="cm1 th1">菜单名</li>
											<li class="sl th1">份数</li>
											<li class="sl1 th1">数量</li>
											<li class="bj1 th1">标价</li>
											<li class="r1 bz1 th1">备注</li>

											
											<?php $cout=0;$sum=0;?>

											{volist name="v['cg']" id="vo" key="kk" }
											
<?php $sum+=($vo['goods_price']*$vo['num']);?>
											<?php ++$cout;?>
	
											<li class="b1 cm1">{$vo.goods_name}</li>
											<li class="b1 sl">{$vo.num}</li>
											<li class="b1 sl1">{$vo.guige}</li>
											<li class="b1 bj1">{$vo.goods_price}</li>
											<li class="b1 r1 bz1">{$vo.desc}</li>

											{/volist}


										</ul>
									
									</div>
									<div class="pihao_ul">
										<ul>
											<li>总金额：{$sum} &nbsp; &nbsp;(元)</li>
											<li>确认采购:(章)</li>
											<li>采购员签名：</li>
											<li>完成时间:</li>
										</ul>	
									</div>
								</div>
								<!--endprint{$sss}-->
								<?php $k+=1;?>
								{/volist}
								</div>
							{/volist}
							</div>
				{/if}		
				{if condition="!empty($day3)"}
							<div class="tab-content tmain" id="tab8" style="padding-left:0px;">
{volist name="day3" id="dv" key="dk"}
<div class="day1" style="margin-bottom:50px;float:left;">
	{volist name="dv" id="v" key="kk"}
	<?php $k=30;?>
		<?php $sss+=1;?>
							<button type="button" onclick="printPage({$sss},'{$v.cg_number}')" style="float:right;" class="button medium back">A4纸打印</button>
								<a href="/index.php/index/index/printcg/cg_number/{$v.cg_number}" style="float:right;" class="button medium back">超市小票纸打印</a>
								<!--startprint{$sss}-->
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<div id="cgmain">
									<div class="cgdiv">
										<div style="font-size:25px;text-align:center;margin-bottom:-20px;margin-top:-10px;">采购单</div>
										<ul class="pihao_ul">
											<li>可用可信家庭市场</li>
											<li>批号：{$v.cg_number}</li>
											<li>配送日期： {$v.ps_date|date='Y-m-d',###}</li>
											<li>配送时间:
											{if condition="($v.ps_time == 9)"}9:00-10:00
											{elseif condition="$v.ps_time == 10"}10:00-11:00
											{elseif condition="$v.ps_time == 11"}11:00-12:00

											{elseif condition="$v.ps_time == 15"}15:00-16:00
											{elseif condition="$v.ps_time == 16"}16:00-17:00
											{elseif condition="$v.ps_time == 17"}17:00-18:00
											{else /}
											{/if}
											</li>
										</ul>
										
									</div>
									<div class="menu_ul">
										<ul>
											<li class="cm1 th1">菜单名</li>
											<li class="sl th1">总数量</li>
											<li class="sl1 th1">数量</li>
											<li class="bj1 th1">标价</li>
											<li class="r1 bz1 th1">备注</li>

											
											<?php $cout=0;$sum=0;?>

											{volist name="v['cg']" id="vo" key="kk" }
											
<?php $sum+=($vo['goods_price']*$vo['num']);?>
											<?php ++$cout;?>
	
											<li class="b1 cm1">{$vo.goods_name}</li>
											<li class="b1 sl">{$vo.num}</li>
											<li class="b1 sl1">{$vo.guige}</li>
											<li class="b1 bj1">{$vo.goods_price}</li>
											<li class="b1 r1 bz1">{$vo.desc}</li>
											{/volist}


										</ul>
									
									</div>
									<div class="pihao_ul">
										<ul>
											<li>总金额：{$sum} &nbsp; &nbsp;(元)</li>
											<li>确认采购:(章)</li>
											<li>采购员签名：</li>
											<li>完成时间:</li>
										</ul>	
									</div>
								</div>
								<!--endprint{$sss}-->
								<?php $k+=1;?>
								{/volist}
						</div>
							{/volist}
								</div>
				{/if}
				
				<!-- End #tab2 -->


			</div>
			<!-- End .content-box-content -->
		</div>
		<!-- End .content-box -->



	</div>
	<!-- End #main-content -->
</div>

<script src="http://cdn.bootcss.com/jquery/3.1.0/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script>

<script>
	function printPage(k,cg_number)
	{
		var bdhtml=window.document.body.innerHTML;//获取当前页面html代码
		var sprnstr= "<!--startprint"+k+"-->" ;
		var eprnstr= "<!--endprint"+k+"-->" ;
		var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18);
		prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
		window.document.body.innerHTML=prnhtml;
		window.print();
		window.document.body.innerHTML=bdhtml;

		if(confirm("是否打印成功？打印成功后，此页面将不再显示该采购表"))
        {location.href="/index.php/index/index/printcg2/cg_number/"+cg_number;}
        else
        {location.href="";}
	}

	message_tips();
	/**
	 * ajax提醒
	 **/
	a = 1;
	function fn(){

		if(a == 1){
			$('#message_tips').css({color:'white'});
			$('#message_tips2').css({color:'white'});
			a = 0;
		}else{
			$('#message_tips').css({color:'#b9df70'});
			$('#message_tips2').css({color:'#b9df70'});
			a = 1;
		}
	}
	var myInterval;
	function message_tips(){
		$.get("/index.php/index/index/tips", function(data){
			if(data != $('#message_tips').html()){
				$('#message_tips').css({color:'#b9df70'});
				myInterval = setInterval(fn,5000);
				$('#message_tips2').css({color:'#b9df70'});
				$("#message_audio").html("<audio id='ttsoundplayer'  autoplay='autoplay'><source src='/static/sound/1583.wav' type='audio/wav'></audio>");

			} else {
				$("#message_audio").html('');
				if(data == 0){
					$('#message_tips').css({color:'white'});
					clearInterval(myInterval);
				}
			}

			$('#message_tips').html(data);
			$('#message_tips2').html(data);
		},'json');
		setTimeout('message_tips()',10000);
	}

function cancel_motai()
    {
    		return false;
    }

</script>

</body>
</html>
